package com.ruoyi.project.manhua.webLook.controller;

import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.project.manhua.webLook.service.MhpictureService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;


/**
 * 漫画章节图片 Controller
 *
 * @author yuan
 * @date 2021-01-13
 */
@Controller
@RequestMapping("/manhua/look/picture")
public class MhpictureController extends BaseController
{
    private String prefix = "manhua/look";

    @Autowired
    private MhpictureService mhpictureService;

    /**
     * 首页请求
     * @return
     */
    @GetMapping("/{nameId}/{nameOrder}")
    public String picture(@PathVariable("nameId")Long nameId, @PathVariable("nameOrder")Integer chapterId, ModelMap mmap)
    {
        mmap.put("pictureData",mhpictureService.pictureService(nameId,chapterId));

        return prefix+"/picture";
    }


    /**
     * 查看 章节 图片
     * @param nameId  漫画 id
     * @param pageId  章节 id
     * @return
     */
    @PostMapping("/pageData")
    @ResponseBody
    public AjaxResult pageData(@RequestParam("nameId")Long nameId,@RequestParam("pageId")Long pageId){

        return AjaxResult.success(mhpictureService.pageDataService(nameId,pageId));
    }



}
